package org.demo.test.thread.interrupt;

public class InterruptDemo {

	
	public static void main(String args[]){
		
		Thread t = new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					System.out.println("线程开始睡觉了!");
					Thread.sleep(5000);
					System.out.println("线程醒过来了!");
				} catch (InterruptedException e) {
					System.out.println("线程出异常了!");
					Thread.currentThread().interrupt();
					e.printStackTrace();
				}
			}
		});
		t.start();
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		t.interrupt();
	}
}
